/*
Copyright 2012 Chris Duck

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

// Original file name: NuGet.Client.cs
// Generation date: 2/11/2012 12:58:54 AM
namespace NuGet.Server.DataServices
{
	public partial class Source
	{
		public Source(string Name, System.Uri Uri, bool Default)
		{
			this.Name = Name;
			this.Uri = Uri;
			this.Default = Default;
		}
		
		public override string ToString()
		{
			return this.Name;
		}
		
		private string _Name;
		public string Name
		{
			get
			{
				return this._Name;
			}
			set
			{
				this._Name = value;
			}
		}
		
		private System.Uri _Uri;
		public System.Uri Uri
		{
			get
			{
				return this._Uri;
			}
			set
			{
				this._Uri = value;
			}
		}
		
		private bool _Default;
		public bool Default
		{
			get
			{
				return this._Default;
			}
			set
			{
				this._Default = value;
			}
		}	
	}
	public partial class Dependency
	{
		public Dependency(string Id, string Version) {
			this.Id = Id;
			this.Version = new System.Version(Version);
		}
		public override string ToString()
		{
			return string.Format("{0}:{1}", this.Id, this.Version);
		}
		
		private string _Id;
		public string Id
		{
			get
			{
				return this._Id;
			}
			set
			{
				this._Id = value;
			}
		}
		
		private System.Version _Version;
		public System.Version Version
		{
			get
			{
				return this._Version;
			}
			set
			{
				this._Version = value;
			}
		}
	}
	
    /// <summary>
    /// There are no comments for NuGet.Server.DataServices.Package in the schema.
    /// </summary>
    /// <KeyProperties>
    /// Id
    /// Version
    /// </KeyProperties>
    public partial class Package
    {
	
		private Source _Source;
		public Source Source
		{
			get
			{
				return this._Source;
			}
			set
			{
				this._Source = value;
			}
		}
		
		private Source _InstalledSource;
		public Source InstalledSource
		{
			get
			{
				return this._InstalledSource;
			}
			set
			{
				this._InstalledSource = value;
			}
		}
		
		private string _ReadStreamUri;
		public string ReadStreamUri
		{
			get
			{
				return this._ReadStreamUri;
			}
			set
			{
				this._ReadStreamUri = value;
			}
		}
		
		public System.Version ServerVersion
		{
			get
			{
				return new System.Version(this.Version);
			}
			set
			{
				if(value != null) {
					this.Version = value.ToString();
				} else {
					this.Version = "";
				}
			}
		}
		
		private System.Version _InstalledVersion;
		public System.Version InstalledVersion
		{
			get
			{
				return this._InstalledVersion;
			}
			set
			{
				this._InstalledVersion = value;
			}
		}
		
		private bool _Subscribed;
		public bool Subscribed
		{
			get
			{
				return this._Subscribed;
			}
			set
			{
				this._Subscribed = value;
			}
		}
		
		public System.Collections.IList DependencyList
		{
			get
			{
				System.Collections.ArrayList DependencyList = new System.Collections.ArrayList();
				if(!string.IsNullOrEmpty(this.Dependencies)) {
					string[] DependencyArray = this.Dependencies.Split('|');
				
					foreach(string DepString in DependencyArray) {
						string[] DepArray = DepString.Split(':');
						DependencyList.Add(new Dependency(DepArray[0], DepArray[1]));
					}
				}
				return DependencyList;
			}
		}
	}
}
